home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / misc / wb_41e.zip / WINBATCH.MA_ < prev    next >
Text File  |  1992-08-26  |  35KB  |  1,589 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                                                     WinBatch User's Guide
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.                                                   Wilson WindowWare, Inc.
  45.                                           2701 California Ave SW  ste 212
  46.                                                         Seattle, WA 98116
  47.  
  48.  
  49.                                                     Orders:(800) 762-8383
  50.                                                  Support:  (206) 937-9335
  51.                                                     Fax:   (206) 935-7129
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.                       Copyright c 1988-1992 by Morrie Wilson.
  59.                                 All rights reserved.
  60.  
  61.  
  62.  
  63.  
  64.         No part of this manual may be reproduced or transmitted in any
  65.         form or by any means, electronic or mechanical, including
  66.         photocopying and recording, for any purpose without the express
  67.         written permission of Wilson WindowWare, Inc.  Information in
  68.         this document is subject to change without notice and does not
  69.         represent a commitment by Wilson WindowWare, Inc.
  70.  
  71.  
  72.  
  73.         The software described herein is furnished under a license
  74.         agreement.  It is against the law to copy this software under any
  75.         circumstances except as provided by the license agreement.
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.         U.S. Government Restricted Rights
  95.         Use, duplication, or disclosure by the Government is subject to
  96.         restrictions as set forth in subdivision (b)(3)(ii) of the Rights
  97.         in Technical Data and Computer Software clause at 252.227-7013.
  98.         Contractor/manufacturer is Wilson WindowWare, Inc./2701 California
  99.         Ave SW /ste 212/Seattle, WA 98116
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.                                                                           ii
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.         Trademarks
  118.         Microsoft and MS-DOS are registered trademarks of Microsoft
  119.         Corporation.
  120.         Windows, Word for Windows, and Excel are trademarks of Microsoft
  121.         Corporation.
  122.  
  123.         WinBatch, Command Post, and File Commander are trademarks of Wilson
  124.         WindowWare, Inc.
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.                                                                          iii
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.                                       CONTENTS
  176.  
  177.  
  178.         CONTENTS                             v
  179.  
  180.         INTRODUCTION                       vii
  181.            System Requirements            viii
  182.            About This Manual                ix
  183.            Notational Conventions           ix
  184.            Acknowledgements                 ix
  185.  
  186.         GETTING STARTED                      1
  187.  
  188.         USING WINBATCH                       3
  189.            Creating WinBatch files           3
  190.            Command-Line Parameters           3
  191.  
  192.         WINBATCH FUNCTIONS                   5
  193.            Introduction                      5
  194.            Function List                     5
  195.            BoxOpen                           6
  196.            BoxShut                           7
  197.            BoxText                           8
  198.            BoxTitle                          9
  199.            CallExt                          10
  200.            DirExist                         12
  201.            IntControl                       13
  202.            MsgTextGet                       14
  203.  
  204.         WINMACRO                            15
  205.            Starting WinMacro                15
  206.            Macro Definition Files           15
  207.            Hotkeys                          17
  208.            Recording Keystrokes             19
  209.            WinMacro Example                 20
  210.            WBM files                        20
  211.            Unrecordable Areas               21
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.                                                                            v
  226.  
  227.                                                                 INTRODUCTION
  228.  
  229.  
  230.  
  231.  
  232.  
  233.                                     INTRODUCTION
  234.  
  235.         WinBatch brings the power of batch language programming to the
  236.         Windows environment.  Although WinBatch can do everything that the
  237.         familiar DOS batch language can do, the capabilities of WinBatch
  238.         begin where the DOS batch language leaves off.
  239.  
  240.  
  241.  
  242.         With almost two hundred functions and commands, WinBatch can:
  243.  
  244.  
  245.            .  Run Windows and DOS programs.
  246.  
  247.            .  Send keystrokes directly to applications.
  248.  
  249.            .  Rearrange, resize, hide, and close windows.
  250.  
  251.            .  Run programs either concurrently or sequentially.
  252.  
  253.            .  Display information to the user in various formats.
  254.  
  255.            .  Prompt the user for any needed input.
  256.  
  257.            .  Present scrollable file and directory lists.
  258.  
  259.            .  Copy, move, delete, and rename files.
  260.  
  261.            .  Read and write files directly.
  262.  
  263.            .  Copy text to and from the Clipboard.
  264.  
  265.            .  Perform string and arithmetic operations.
  266.  
  267.            .  Make branching decisions based upon numerous factors.
  268.  
  269.  
  270.         And much, much more.
  271.  
  272.  
  273.  
  274.         Whether you are creating batch files for others, or looking for a
  275.         way to automate your own work and eliminate the drudgery of
  276.         repetitive tasks, you will find WinBatch to be a powerful,
  277.         versatile, and easy-to-use tool.
  278.  
  279.  
  280.  
  281.  
  282.  
  283.                                                                          vii
  284.  
  285.                                                                 INTRODUCTION
  286.  
  287.  
  288.  
  289.  
  290.  
  291.         System Requirements
  292.  
  293.  
  294.  
  295.         WinBatch requires an IBM PC or compatible with a minimum of 640K
  296.         memory running Microsoft Windows version 3.0 or higher.
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.                                                                         viii
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.         About This Manual
  349.         WinBatch is an application which uses our Windows Interface
  350.         Language (WIL).  Please refer to the WIL Reference Manual for an
  351.         introduction to WIL, as well as for complete documentation of the
  352.         many functions available in WIL (and therefore, in WinBatch).
  353.  
  354.         This User's Guide includes only topics and functions which are
  355.         exclusive to WinBatch or which behave differently in WinBatch, as
  356.         well as additions and changes that have been made since the WIL
  357.         Reference Manual went to press.  It also covers the use of
  358.         WinMacro, a separate program which is included in the WinBatch
  359.         package.
  360.  
  361.         Note: WinBatch is a batch file based implementation of WIL.
  362.  
  363.  
  364.  
  365.  
  366.         Notational Conventions
  367.         Throughout this manual, we use the following conventions to
  368.         distinguish elements of text:
  369.  
  370.         ALL-CAPS
  371.            Used for filenames.
  372.  
  373.         Boldface
  374.            Used for important points, programs, function names, and parts of
  375.            syntax that must appear as shown.
  376.  
  377.         system
  378.            Used for items in menus and dialogs, as they appear to the user.
  379.  
  380.         Small fixed-width
  381.            Used for WIL sample code.
  382.  
  383.         Italics
  384.            Used for emphasis, and to liven up the documentation just a bit.
  385.  
  386.  
  387.  
  388.  
  389.         Acknowledgements
  390.         WinBatch software developed by Morrie Wilson.
  391.  
  392.         Documentation written by Richard Merit.
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.                                                                           ix
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.                                   GETTING STARTED
  408.  
  409.         WinBatch is quite easy to install.  You will find an appropriate
  410.         diskette in your WinBatch package.  Take the diskette and insert it
  411.         into your floppy drive.  The WinBatch installation program is
  412.         itself a Windows application, so make sure Windows is running.
  413.  
  414.         From Program Manager, double-click on the File Manager icon.  When
  415.         File Manager starts, click on the A: or B: drive icon, depending on
  416.         which floppy drive contains the WinBatch diskette.  A directory
  417.         tree will appear for the WinBatch diskette.  You should see a root
  418.         directory icon.  Double-click on this icon and a list of filenames
  419.         will appear.  Find the filename WSETUP.EXE and double-click on it.
  420.         Follow whatever instructions WSETUP gives you.
  421.  
  422.         WSETUP will copy or create the necessary files in a directory of
  423.         your choice.
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.                                                                            1
  458.  
  459.                                                                        USING
  460.                                                                     WINBATCH
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                                        USING
  467.                                       WINBATCH
  468.  
  469.  
  470.  
  471.  
  472.         Creating WinBatch files
  473.         WinBatch is a batch file interpreter.  Therefore, before you can do
  474.         anything useful with WinBatch, you must create at least one
  475.         WinBatch file to run.  WinBatch files are plain text files, which
  476.         you can create with Notepad or a comparable text editor.  Each WIL
  477.         statement appears on a separate line, and can be a maximum of 255
  478.         characters long (refer to the WIL Reference Manual for information
  479.         on the commands you can use in WinBatch).  Indentation does not
  480.         matter.
  481.  
  482.         You should give each WinBatch file a name which has an extension of
  483.         WBT (eg, TEST.WBT).  We'll use the terms WinBatch files and WBT
  484.         files interchangeably.
  485.  
  486.  
  487.  
  488.  
  489.         Command-Line Parameters
  490.         WinBatch is run with the following command line:
  491.  
  492.            WINBATCH filename.wbt p1 p2 ... p9
  493.  
  494.         "filename.wbt" is any valid WBT file, and is a required parameter.
  495.  
  496.         "p1 p2 ... p9" are optional parameters (maximum of nine) to be
  497.         passed to the WBT file on startup, delimited by spaces.
  498.  
  499.         You can launch WinBatch using any method that is convenient for
  500.         you.  The WinBatch setup program associates WBT files with
  501.         WINBATCH.EXE, so you can just double-click on a WBT file in File
  502.         Manager or a similar program (however, see the Note below).  Or,
  503.         you can create a Program Manager icon which executes the
  504.         appropriate command line (see your Windows manual for further
  505.         details).
  506.  
  507.         Parameters passed to a WBT file are automatically parsed into
  508.         variables named param1, param2, etc.  An additional variable,
  509.         param0, is the total number of command-line parameters.
  510.  
  511.  
  512.  
  513.  
  514.  
  515.                                                                            3
  516.  
  517.                                                                        USING
  518.                                                                     WINBATCH
  519.  
  520.  
  521.  
  522.  
  523.         Note: If you "run" a WBT file directly, using the file association
  524.         capability of Windows, it will not receive any command line
  525.         parameters.  In order to pass parameters to a WinBatch file, you
  526.         must run WINBATCH.EXE, followed by the name of the WBT file and any
  527.         other desired parameters.
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.                                                                            4
  574.  
  575.                                                           WINBATCH FUNCTIONS
  576.  
  577.  
  578.  
  579.  
  580.  
  581.                                  WINBATCH FUNCTIONS
  582.  
  583.  
  584.  
  585.  
  586.         Introduction
  587.         This section includes only those additional WinBatch functions
  588.         which do not appear in the WIL Reference Manual.  The WIL Reference
  589.         Manual is your primary reference to the functions available in
  590.         WinBatch.
  591.  
  592.         Note: The functions listed under the See Also headings may be
  593.         documented either in this User's Guide or in the WIL Reference
  594.         Manual.
  595.  
  596.  
  597.  
  598.  
  599.         Function List
  600.  
  601.  
  602.         BoxOpen (title, text)
  603.            Opens a WinBatch message box.
  604.  
  605.         BoxShut ( )
  606.            Closes the WinBatch message box.
  607.  
  608.         BoxText (text)
  609.            Changes the text in the WinBatch message box.
  610.  
  611.         BoxTitle (title)
  612.            Changes the title of the WinBatch message box.
  613.  
  614.         CallExt (filename, parameters)
  615.            Calls another WBT file as a separate subprogram.
  616.  
  617.         DirExist ([d:]path)
  618.            Determines if a directory exists.
  619.  
  620.         IntControl (request#, p1, p2, p3, p4)
  621.            Internal control functions.
  622.  
  623.         MsgTextGet (window-name)
  624.            Returns the contents of a Windows message box.
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.                                                                            5
  632.  
  633.                                                                      BOXOPEN
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.         BoxOpen
  644.         Opens a WinBatch message box.
  645.  
  646.  
  647.         Syntax:
  648.            BoxOpen (title, text)
  649.  
  650.         Parameters:
  651.            (s) title title of the message box.
  652.            (s) text  text to display in the message box.
  653.  
  654.         Returns:
  655.            (i)       always 1.
  656.  
  657.  
  658.         This function opens a message box with the specified title and
  659.         text.  The message box stays in the foreground while the WIL
  660.         program continues to process.  The title of an existing message box
  661.         can be changed with the BoxTitle function, and the text inside the
  662.         box can be changed with the BoxText function.  Use BoxShut to close
  663.         the message box.
  664.  
  665.  
  666.         Example:
  667.            BoxOpen("Processing", "Be patient")
  668.            BoxTitle("Still processing")
  669.            BoxText("Almost done")
  670.            BoxShut()
  671.  
  672.  
  673.         See Also:
  674.            BoxShut, BoxText, BoxTitle, Display, Message
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.                                                                            6
  690.  
  691.                                                                      BOXSHUT
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.         BoxShut
  702.         Closes the WinBatch message box.
  703.  
  704.  
  705.         Syntax:
  706.            BoxShut ( )
  707.  
  708.         Parameters:
  709.            (none)
  710.  
  711.         Returns:
  712.            (i)       always 1.
  713.  
  714.  
  715.         This function closes the message box that was opened with BoxOpen.
  716.  
  717.  
  718.         Example:
  719.            BoxOpen("Processing", "Be patient")
  720.            BoxTitle("Still processing")
  721.            BoxText("Almost done")
  722.            BoxShut()
  723.  
  724.  
  725.         See Also:
  726.            BoxOpen, BoxText, BoxTitle
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.                                                                            7
  748.  
  749.                                                                      BOXTEXT
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.         BoxText
  760.         Changes the text in the WinBatch message box.
  761.  
  762.  
  763.         Syntax:
  764.            BoxText (text)
  765.  
  766.         Parameters:
  767.            (s) text  text to display in the message box.
  768.  
  769.         Returns:
  770.            (i)       always 1.
  771.  
  772.  
  773.         This function changes the text in the message box opened with
  774.         BoxOpen.
  775.  
  776.  
  777.         Example:
  778.            BoxOpen("Processing", "Be patient")
  779.            BoxTitle("Still processing")
  780.            BoxText("Almost done")
  781.            BoxShut()
  782.  
  783.  
  784.         See Also:
  785.            BoxOpen, BoxShut, BoxTitle
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.                                                                            8
  806.  
  807.                                                                     BOXTITLE
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.         BoxTitle
  818.         Changes the title of the WinBatch message box.
  819.  
  820.  
  821.         Syntax:
  822.            BoxTitle (title)
  823.  
  824.         Parameters:
  825.            (s) title title of the message box.
  826.  
  827.         Returns:
  828.            (i)       always 1.
  829.  
  830.  
  831.         This function changes the title of the message box opened with
  832.         BoxOpen.
  833.  
  834.  
  835.         Example:
  836.            BoxOpen("Processing", "Be patient")
  837.            BoxTitle("Still processing")
  838.            BoxText("Almost done")
  839.            BoxShut()
  840.  
  841.  
  842.         See Also:
  843.            BoxOpen, BoxShut, BoxText, WinTitle
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.                                                                            9
  864.  
  865.                                                                      CALLEXT
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.         CallExt
  876.         Calls another WBT file as a separate subprogram.
  877.  
  878.  
  879.         Syntax:
  880.            CallExt (filename, parameters)
  881.  
  882.         Parameters:
  883.            (s) filename.wbt the WBT file you are calling (the extension is
  884.                      required).
  885.            (s) parameters the parameters to pass to the file, if any, in the
  886.                      form
  887.                      "p1 p2 p3 ... pn".
  888.  
  889.         Returns:
  890.            (i)       always 0.
  891.  
  892.  
  893.         This function is used to pass control temporarily to a secondary
  894.         WBT file.  The main WBT file can optionally pass parameters to the
  895.         secondary WBT file.  All variables are exclusive (local) to their
  896.         respective files, so that neither WBT file "knows about" variables
  897.         being used by the other.  The secondary WBT file should end with a
  898.         Return statement, to pass control back to the main WBT file.
  899.  
  900.         If a string of parameters is passed to the secondary WBT file, it
  901.         will automatically be parsed into individual variables with the
  902.         names param1, param2, etc. (maximum of nine parameters).  The
  903.         variable param0 will be a count of the total number of parameters
  904.         in the string.
  905.  
  906.  
  907.         Example:
  908.            ; MAIN.WBT
  909.            old = AskLine("RENAME", "File to rename", "")
  910.            If !FileExist(old) Then Exit
  911.            new = AskLine("RENAME", "New name for %old%", "")
  912.            If FileExist(new) Then Exit
  913.            CallExt("rename.wbt", "%old% %new%")
  914.  
  915.                <continued next page>
  916.  
  917.  
  918.  
  919.  
  920.  
  921.                                                                           10
  922.  
  923.                                                           WINBATCH FUNCTIONS
  924.  
  925.  
  926.  
  927.  
  928.            ; RENAME.WBT
  929.            old = param1
  930.            new = param2
  931.            FileRename(old, new)
  932.            Return
  933.  
  934.  
  935.         See Also:
  936.            Call, ParseData, Return
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.                                                                           11
  980.  
  981.                                                                     DIREXIST
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.         DirExist
  992.         Determines if a directory exists.
  993.  
  994.  
  995.         Syntax:
  996.            DirExist ([d:]path)
  997.  
  998.         Parameters:
  999.            (s) [d:]pathdirectory name, with optional drive.
  1000.  
  1001.         Returns:
  1002.            (i)       @TRUE if the directory exists;
  1003.                      @FALSE if it doesn't exist.
  1004.  
  1005.         You can use this function to determine whether a specified drive is
  1006.         valid by checking for the existence of the root directory on that
  1007.         drive.
  1008.  
  1009.  
  1010.         Examples:
  1011.            wpdir = "c:\wp"
  1012.            If DirExist(wpdir) == @FALSE Then DirMake(wpdir)
  1013.            DirChange(wpdir)
  1014.  
  1015.            :top
  1016.            drive = AskLine("Run Excel", "Enter a drive letter", "")
  1017.            If drive == "" Then Exit
  1018.            drive = StrSub(drive, 1, 1)
  1019.            If DirExist("%drive%:\") == @FALSE Then Goto top
  1020.            NetAddCon("\\userapps\excel", "", drive)
  1021.  
  1022.  
  1023.         See Also:
  1024.            DirChange, DirMake, DirRemove, DirRename, FileExist
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.                                                                           12
  1038.  
  1039.                                                                   INTCONTROL
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.         IntControl
  1050.         Internal control functions.
  1051.  
  1052.  
  1053.         Syntax:
  1054.            IntControl (request#, p1, p2, p3, p4)
  1055.  
  1056.         Parameters:
  1057.            (i) request#specifies which sub-function is to be performed (see
  1058.                      below).
  1059.            (s) p1 - p4 parameters which may be required by the function
  1060.                      (see below).
  1061.  
  1062.         Returns:
  1063.            (s)       varies (see below).
  1064.  
  1065.         Short for Internal Control, a special function that permits
  1066.         numerous internal operations.  The first parameter of IntControl
  1067.         defines exactly what the function does, the other parameters are
  1068.         possible arguments to the function.
  1069.  
  1070.         Refer to the WIL Reference Manual for information on other sub-
  1071.         functions.
  1072.  
  1073.  
  1074.         IntControl (12, p1, 0, 0, 0)
  1075.         Used to direct WinBatch to allow itself to be terminated without
  1076.         warning when Windows shuts down and a batch file is still running
  1077.  
  1078.            P1Meaning
  1079.  
  1080.            0 WinBatch complains on shutdown (default)
  1081.            1 WinBatch will terminate quietly
  1082.  
  1083.  
  1084.         IntControl (15, 0, 0, 0, 0)
  1085.         Returns currently executing WBT file name; the same as the
  1086.         "paramfile" variable.
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.                                                                           13
  1096.  
  1097.                                                                   MSGTEXTGET
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.         MsgTextGet
  1108.         Returns the contents of a Windows message box.
  1109.  
  1110.  
  1111.         Syntax:
  1112.            MsgTextGet (window-name)
  1113.  
  1114.         Parameters:
  1115.            (s) window-name  full title of the message box window.
  1116.  
  1117.         Returns:
  1118.            (s)       contents of the message box.
  1119.  
  1120.  
  1121.         This function returns the text contents of a standard Windows
  1122.         message box.  "Window-name" must be the full title of the message
  1123.         box window, and is case-sensitive.
  1124.  
  1125.         Note: This function will not work with the types of message boxes
  1126.         created by most WIL functions, since they are not standard Windows
  1127.         message boxes.
  1128.  
  1129.  
  1130.         Example:
  1131.            msg = MsgTextGet("Microsoft Word")
  1132.            If msg == "Search text not found" Then SendKey("~")
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.                                                                           14
  1154.  
  1155.  
  1156.                                                                     WINMACRO
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.                                       WINMACRO
  1163.  
  1164.         WinMacro is a standalone companion program included in the WinBatch
  1165.         package, which lets you create macro files and "attach" them to the
  1166.         control menu of any Windows application.  These macros can then be
  1167.         executed, either by selecting them from the control menu, or
  1168.         through the use of a "hotkey."  WinMacro also has the ability to
  1169.         "record" keystrokes, which can later be "played back" virtually
  1170.         anywhere in the Windows environment.
  1171.  
  1172.  
  1173.  
  1174.  
  1175.         Starting WinMacro
  1176.         You can run WINMACRO.EXE just like any other Windows program, using
  1177.         your favorite Windows-program-starting method (keyboard, mouse,
  1178.         Program Manager, File Manager, MS-DOS Executive, Command Post, File
  1179.         Commander, WinBatch, etc.).  However, if you will be using WinMacro
  1180.         on a regular basis, you may wish to have it load automatically when
  1181.         you start up Windows.  You can do this by adding WINMACRO.EXE to
  1182.         the LOAD= line in your WIN.INI file (consult your Microsoft Windows
  1183.         manual for more information).
  1184.  
  1185.         WinBatch starts up as an icon, and remains active until you either
  1186.         close it or end your Windows session (whichever comes first).
  1187.  
  1188.  
  1189.  
  1190.  
  1191.         Macro Definition Files
  1192.         WinMacro definition (WDF) files are plain ASCII files which you
  1193.         create and edit.  They must have a WDF extension, and they must be
  1194.         located in the same directory as WINMACRO.EXE.  A WDF file contains
  1195.         any number of definition lines, each of which represents an
  1196.         individual command.  Each line has the following format:
  1197.  
  1198.            Title  [\ optional hotkey] :  program to be executed
  1199.  
  1200.         Title is the name which will appear on the application's control
  1201.         menu to identify the command.  The hotkey is optional; if it is
  1202.         included, it must be preceded by a backslash (\).  This is followed
  1203.         by a colon (:), and then the program which should be executed when
  1204.         the command is selected, with any required parameters.  This can be
  1205.         any Windows or DOS EXE, COM, PIF, or BAT file, and you must include
  1206.  
  1207.  
  1208.  
  1209.                                                                           15
  1210.  
  1211.  
  1212.                                                                     WINMACRO
  1213.  
  1214.  
  1215.  
  1216.  
  1217.         the appropriate file extension.  If the program isn't located
  1218.         either in the current directory or on your DOS path, you must
  1219.         include a path specification for it.  To run a WinBatch file, run
  1220.         WINBATCH.EXE, with the name of the WBT file as a parameter.
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.                                                                           16
  1266.  
  1267.  
  1268.                                                                     WINMACRO
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.         Let's create a WinMacro definition file, named GLOBAL.WDF:
  1276.  
  1277.            Run Notepad           : notepad.exe
  1278.            Play Solitaire   \ ^F9   : winbatch.exe solitare.wbt
  1279.  
  1280.         (This second line assumes that you have created SOLITARE.WBT as
  1281.         part of the WIL tutorial.  If not, just substitute any WBT file
  1282.         name).
  1283.  
  1284.         GLOBAL.WDF is a special file name.  When WinMacro starts up, it
  1285.         looks for this file.  If present, WinMacro loads it, and attaches
  1286.         its contents to the control menu of every window currently running,
  1287.         as well as any windows that may subsequently be opened (the control
  1288.         menu, also known as the system menu, is the menu that you access by
  1289.         pressing Alt-Space, or by clicking the little box which appears at
  1290.         the left side of the title bar of almost all application windows).
  1291.  
  1292.         Go ahead and start up WinMacro, then access the control menu of any
  1293.         open window.  You should see that the two commands in your
  1294.         GLOBAL.WDF file have been attached to the control menu, and both
  1295.         are now available for your use.  You can run these user-defined
  1296.         commands by selecting them from the menu.  In addition, because you
  1297.         have defined a hotkey for the "Play Solitaire" command, you can run
  1298.         it from any window by pressing Ctrl-F9.
  1299.  
  1300.  
  1301.  
  1302.  
  1303.         Hotkeys
  1304.         You can assign a hotkey to any WinMacro definition line.  A  hotkey
  1305.         consists of the Ctrl key plus any letter (A - Z) or function (F1 -
  1306.         F16) key.  In addition, you can optionally use the Alt and Shift
  1307.         keys:
  1308.  
  1309.            Key        Char
  1310.  
  1311.            Ctrl      ^
  1312.            Alt       !
  1313.            Shift     +
  1314.  
  1315.         Here are some examples of valid key combinations:
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.                                                                           17
  1322.  
  1323.  
  1324.                                                                     WINMACRO
  1325.  
  1326.  
  1327.  
  1328.  
  1329.            Hotkey    Equivalent keystrokes
  1330.  
  1331.            ^F5       Ctrl-F5
  1332.            ^!F5   Ctrl-Alt-F5
  1333.            ^+F5   Ctrl-Shift-F5
  1334.            ^!+F5     Ctrl-Alt-Shift-F5
  1335.            ^D     Ctrl-D
  1336.            ^!D       Ctrl-Alt-D
  1337.            ^+D    Ctrl-Shift-D
  1338.            ^!+D   Ctrl-Alt-Shift-D
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.                                                                           18
  1378.  
  1379.  
  1380.                                                                     WINMACRO
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.         In addition to GLOBAL.WDF, you can create application-specific
  1388.         WinMacro definition files.  They have the form progname.WDF, where
  1389.         "progname" is the name of the application's COM or EXE file.  So,
  1390.         if you wanted to have a WDF file which would apply only to Notepad,
  1391.         you would name it NOTEPAD.WDF.  Its contents would be attached only
  1392.         to Notepad's control menu, and its hotkeys would be active only
  1393.         when Notepad was the active window.  WinMacro loads application-
  1394.         specific WDF files after GLOBAL.WDF, so if you have, for example, a
  1395.         NOTEPAD.WDF file, it's contents will be attached to Notepad's
  1396.         control menu in addition to (not instead of) GLOBAL.WDF.  If you
  1397.         define the same hotkey in GLOBAL.WDF and NOTEPAD.WDF, the one in
  1398.         NOTEPAD.WDF will apply.
  1399.  
  1400.         If you edit a WDF file while WinMacro is running, and want to see
  1401.         the changes reflected in the current menus, select About/Reload
  1402.         from the WinMacro icon's menu.  All windows will be updated.
  1403.  
  1404.  
  1405.  
  1406.  
  1407.         Recording Keystrokes
  1408.         Another feature of WinMacro is the ability to record keystrokes to
  1409.         a file, which can be played back at a later time.  To do this, make
  1410.         sure that WinMacro is running, and then type Ctrl-Shift-Home from
  1411.         any window, or select Begin Macro Record from the WinMacro icon's
  1412.         menu.  WinMacro will present you with a menu of existing WBM files.
  1413.         If you want to overwrite an existing file, select its name from the
  1414.         menu; otherwise, enter a name for the file you wish to create in
  1415.         the edit box (a WBM extension will automatically be added), and
  1416.         press the Enter key or click on the OK button.  At this point, the
  1417.         icon will begin flashing, indicating that you are in record mode.
  1418.  
  1419.         Once you are in record mode, every keystroke you type will be
  1420.         recorded to your WBM file.  Mouse movement and mouse clicks are not
  1421.         recorded.  To end record mode, type Ctrl-Shift-End from any window,
  1422.         or click on the flashing WinMacro icon and select End Macro Record
  1423.         from the menu.  The icon will stop flashing.
  1424.  
  1425.         Once you have created a WBM keystroke macro file, you can assign it
  1426.         to a hotkey in a WDF file, using the steps outlined above.  You use
  1427.         WinBatch to run WBM files, the same way you do with WBT files.
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.                                                                           19
  1434.  
  1435.  
  1436.                                                                     WINMACRO
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.         WinMacro Example
  1447.         Let's create a macro for Solitaire which will cycle to the next
  1448.         deck back design (sound familiar?).  First, WinMacro should be
  1449.         running.  Next, start up Solitaire, and make sure that it is the
  1450.         current window.  Now, activate keystroke record mode, as outlined
  1451.         above, and name the file SOLITARE.WBM.  Once the WinMacro icon
  1452.         begins flashing, we're ready to record.  Enter the following series
  1453.         of keystrokes:
  1454.  
  1455.            Alt-G
  1456.            C
  1457.            Cursor right
  1458.            Space
  1459.            Enter
  1460.  
  1461.         And end record mode.  Now, create a WinMacro definition file named
  1462.         SOL.WDF, containing the following entry:
  1463.  
  1464.            Change deck design    \ ^C : winbatch.exe solitare.wbm
  1465.  
  1466.         Finally, select About/Reload from the WinMacro icon's menu.  Your
  1467.         new command is now available from the Solitaire control menu, or
  1468.         simply by typing Ctrl-C when the Solitaire window is active.
  1469.  
  1470.  
  1471.  
  1472.  
  1473.         WBM files
  1474.         If you look at a WBM file, you will see that it is nothing more
  1475.         than a series of one or more SendKey statements.  For example, the
  1476.         SOLITARE.WBM file that we just created looks something like this
  1477.  
  1478.            ; Recorded Macro D:\WINDOWS\BATCH\SOLITARE.WBM
  1479.            SendKey(`!gc{RIGHT} {ENTER}`)
  1480.            ; End Recorded Macro
  1481.  
  1482.         If you glance back at the SOLITARE.WBT file which appears at the
  1483.         end of the Tutorial section of the WIL Reference Manual, you will
  1484.         find a line which looks amazingly like the middle one above (~ has
  1485.  
  1486.  
  1487.  
  1488.  
  1489.                                                                           20
  1490.  
  1491.  
  1492.                                                                     WINMACRO
  1493.  
  1494.  
  1495.  
  1496.  
  1497.         the same meaning as {ENTER}).  This demonstrates that WBM files are
  1498.         simply WBT files in disguise.
  1499.  
  1500.         So, why do we use different extensions for the two types of files?
  1501.         Consider, if you will, that a WBT file is a standalone program,
  1502.         which can be run from the Program Manager or File Manager.  It
  1503.         starts up whatever other programs it needs, does its work, and
  1504.         cleans up after itself.  A WBM file, on the other hand, is only a
  1505.         program fragment.  When called, it sends a sequence of keystrokes
  1506.         to the active window, but it neither knows nor cares what window
  1507.         that may happen to be.  In Solitaire, Alt-G selects the Game menu;
  1508.         in another program, it may trigger the Goodbye function.  Needless
  1509.         to say, WBM files should be played back only in the window where
  1510.         they were recorded, and the easiest way to ensure this is to attach
  1511.         them to application-specific WDF files, as we have done here with
  1512.         Solitaire.  That's why we distinguish them from regular WBT files.
  1513.  
  1514.         However, because SendKey is a perfectly respectable WinBatch
  1515.         function ---
  1516.         statements ---
  1517.         and later incorporate it into a full-fledged WinBatch file.
  1518.         Suppose that we had a one-line WinBatch WBT file like this:
  1519.  
  1520.            RunZoom("sol.exe", "")
  1521.  
  1522.         and we wanted to follow that with a SendKey statement to change the
  1523.         deck design every time the file was run.  Instead of laboring over
  1524.         the WinBatch manual to find the cryptic symbols necessary to
  1525.         accomplish such a feat, we could simply use the WinMacro record
  1526.         feature to create a WBM file, as we did above, and then paste the
  1527.         resulting SendKey statement into the WinBatch WBT file:
  1528.  
  1529.            RunZoom("sol.exe", "")
  1530.            SendKey(`!gc{RIGHT} {ENTER}`)
  1531.  
  1532.         You can also use your favorite editor to remove any accidental
  1533.         keystrokes you make when you are recording a WBM file.
  1534.  
  1535.  
  1536.  
  1537.  
  1538.         Unrecordable Areas
  1539.         WinMacro is unable to record keystrokes entered in Windows' System
  1540.         Modal Dialog Boxes.  These include the dialog boxes in the MS-DOS
  1541.         Executive window, as well as dialog boxes generated by severe
  1542.         system errors.  By the same token, WinBatch cannot play back
  1543.         keystrokes in these types of dialog boxes.
  1544.  
  1545.                                                                           21
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.                                                                           22
  1589.